import java.util.Scanner;

public class demo1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int b = in.nextInt();
            int sum=0;
            for(int i=a;i<=b;i++){
                sum+=sums(i);
            }
            System.out.println(sum);
        }
    }
    public  static int sums(int x){
        int sum=0;
        while(x!=0){
            int temp=x%10;
            if(temp==2)sum++;
            x/=10;
        }
        return sum;
    }
}
